<?php
session_start();
include_once('DAOUser.php');
$oUsuario = unserialize($_SESSION['oUsuario']); 
$iError = $_GET['error'];
$sTodayDay = date('d');
$sTodayMonth = date('m');
$sTodayYear = date('Y'); 
if($oUsuario->getNivelUsuario() == "admin" || $oUsuario->getNivelUsuario() == "super_admin"){
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Dia Inhabil</title>
<script src="../script/eventos.js" type="text/javascript"></script>
<meta name="viewport" content="width=device-width" />

<link href="../css/view_mobile.css" type="text/css" rel="stylesheet" media="screen and (min-width: 0px) and (max-width: 350px)"/>
<link href="../css/view.css" type="text/css" rel="stylesheet" media="only screen and (min-width: 351px)" /> 
</head>

<body onBlur="self.focus()">
<div id="adminEvent">
    <div id="error"><?php if($iError == 1) echo "Faltaron Llenar Campos"; ?></div>
    <form action="saveNuevoDiaInhabil.php" name="nuevoDiaInhabil" id="nuevoDiaInhabil" method="post">
    <fieldset>
    	<legend> D&iacute;a Inhabil </legend>
    <div class="inline">
    	<label for="anioInicio">Fecha Inicio:</label><br />
    	<select name="anioInicio" id="anioInicio">
    						<?php
								$sSelected = "";
								for($numOptionsAnio=2011;$numOptionsAnio<2026;$numOptionsAnio++){
									if($sTodayYear == $numOptionsAnio)
										$sSelected = 'selected="selected"';
									echo '<option value="'.$numOptionsAnio.'" '.$sSelected.' > '.$numOptionsAnio.' </option>';
									$sSelected = "";
								}	
							?>
        </select>
        <select name="mesInicio" onchange="changeDays(document.getElementById('anioFin').value,this.value);">
                                <?php 
                                    for($numOptionsMes=1;$numOptionsMes<13;$numOptionsMes++){
                                        if($sTodayMonth == $numOptionsMes)
                                            $sSelected = 'selected="selected"';
                                        
                                        if($numOptionsMes<10)
                                                echo '<option value="0'.$numOptionsMes.'" '.$sSelected.'> 0'.$numOptionsMes.' </option>';
                                        else
                                            echo '<option value="'.$numOptionsMes.'" '.$sSelected.'> '.$numOptionsMes.' </option>';
                                        $sSelected = "";
                                    }
                                ?>
        </select>
        <span id="dias">
        <select name="diaInicio">
                                <?php 
                                    for($numOptionsDia=1;$numOptionsDia<32;$numOptionsDia++){
                                        if($sTodayDay == $numOptionsDia)
                                            $sSelected = 'selected="selected"';
                                        
                                        if($numOptionsDia<10)
                                            echo '<option value="0'.$numOptionsDia.'" '.$sSelected.'> 0'.$numOptionsDia.' </option>';
                                        else
                                            echo '<option value="'.$numOptionsDia.'" '.$sSelected.'> '.$numOptionsDia.' </option>';
                                        $sSelected = "";
                                    }
                                ?>
        </select>
        </span>	
    </div><br />
    <div class="inline"><label for="fechaFin">Fecha Fin:</label><br />
    <select name="anioFin" id="anioFin">
    						<?php
								$sSelected = "";
								for($numOptionsAnio=2011;$numOptionsAnio<2026;$numOptionsAnio++){
									if($sTodayYear == $numOptionsAnio)
										$sSelected = 'selected="selected"';
									echo '<option value="'.$numOptionsAnio.'" '.$sSelected.' > '.$numOptionsAnio.' </option>';
									$sSelected = "";
								}	
							?>
    </select>
    <select name="mesFin" onchange="changeDays2(document.getElementById('anioFin').value,this.value);">
    						<?php 
								for($numOptionsMes=1;$numOptionsMes<13;$numOptionsMes++){
									if($sTodayMonth == $numOptionsMes)
										$sSelected = 'selected="selected"';
									
									if($numOptionsMes<10)
											echo '<option value="0'.$numOptionsMes.'" '.$sSelected.'> 0'.$numOptionsMes.' </option>';
									else
										echo '<option value="'.$numOptionsMes.'" '.$sSelected.'> '.$numOptionsMes.' </option>';
									$sSelected = "";
								}
							?>
    </select>
    <span id="dias2">
    <select name="diaFin">
    						<?php 
								for($numOptionsDia=1;$numOptionsDia<32;$numOptionsDia++){
									if($sTodayDay == $numOptionsDia)
										$sSelected = 'selected="selected"';
									
									if($numOptionsDia<10)
										echo '<option value="0'.$numOptionsDia.'" '.$sSelected.'> 0'.$numOptionsDia.' </option>';
									else
										echo '<option value="'.$numOptionsDia.'" '.$sSelected.'> '.$numOptionsDia.' </option>';
									$sSelected = "";
								}
							?>
    </select></span></div><br />
    <input type="submit" name="guardar" value="Guardar" class="botonSubmit"  />
    </fieldset>
    </form>
</div>
<?php 
}else
	echo "<h2>NO POSEE PERMISOS PARA AGREGAR EVENTOS</h2>"
?>
</body>
</html>